package com.situ.mall.order.controller;

import com.situ.mall.common.service.IOrderInfoService;
import com.situ.mall.order.service.ICartService;
import com.situ.mall.common.vo.CartVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private ICartService cartService;
    @Autowired
    private IOrderInfoService orderInfoService;
    @PostMapping("/save")
    public String save(String ids, Integer addId, Model model){
        List<CartVO> carts=cartService.list1(ids);
        model.addAttribute("carts",carts);
        String qrcode = orderInfoService.saveOrder(ids,addId);
        model.addAttribute("qrCode",qrcode);
        return "orderpay";
    }
}
